package migrator

import (
	"mig/pkg/data"
	"mig/pkg/types"
)

type Migrator interface {
	Migrate(source data.Database, target data.Database, unequalChunks []types.UnequalChunk) (*types.IntegrityInfo, error)
}

func NewMigrator(algorithm types.Algorithm, chunkSize int64, maxWorkers int) Migrator {
	switch algorithm {
	case types.AlgorithmDigest, types.AlgorithmDigestV2:
		return NewDigestMigrator(chunkSize, maxWorkers)
	case types.AlgorithmBloomFilter:
		return NewBloomFilterMigrator(chunkSize, maxWorkers)
	case types.AlgorithmCommon:
		return NewCommonMigrator(chunkSize, maxWorkers)
	default:
		return nil
	}
}
